﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>登录</title>
    <link href="/Content/css/mui.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" media="screen" href="/Content/css/main.css" />
    <script type="text/javascript" src="/Scripts/js/flexible.js"></script>
    <script type="text/javascript" src="/Scripts/js/jquery.js"></script>
    <script src="/Scripts/js/mui.js"></script> 
</head>
<body>
    <div class="title-header">移动办公管理系统</div>
    <div class="login-part">
        <div class="login-title">天津中网科技有限公司</div>
        <div class="login-from">
            <div class="login-from-item"><i class="iconfont">&#xe666;</i><input type="text" class="username" value="@(ViewBag.name==null?"":ViewBag.name)" /></div>
            <div class="login-from-item"><i class="iconfont">&#xe62a;</i><input type="password" class="password" value="@(ViewBag.pwd==null?"":ViewBag.pwd)" /></div>
            <div class="login-from-item ts">
                <label class="demo--label">
                    <input class="demo--radio" checked="@(ViewBag.cb==null?"":ViewBag.cb)" type="checkbox" name="demo-checkbox1">
                    <span class="demo--checkbox demo--radioInput"></span>记住密码
                </label>
            </div>
            <div class="login-from-item"><button onclick="return login()" class="login-btn" style="font-size:1em" >登录</button></div>
        </div>
    </div>

</body>
</html>
<script>
    $(document).ready(function () {
        //Login
        var init = {
            loginBtn: $('.login-btn'),
            unameBox: $('.username'),
            pwdBox: $(".password")
        };
    })
    function login() {
        var name = $(".username").val();
        var pwd = $(".password").val();
        if (name.length < 1 || pwd.length < 1) {
            mui.toast("用户名或密码不能为空！");
            return false;
        }
        var postdata = {
            name: name,
            pwd: pwd,
            cb: $(".demo--radio").attr("checked") == "checked" ? 1 : 0
        };
        $.post("/Home/UserLogin", postdata, function (data) {
            if (data.Code == 1) {
                window.location.href = "/Home/Index"
            }
            else {
                mui.toast(data.Msg);
                return false;
            }
        });
    }
</script>